section.col-xs-12.content(ng-controller='FundCtrl')

  //- Disconnected

  group.disconnected(ng-hide='connected')
    p.literal(l10n="err-you-must-be-online-to-see-this-screen")
      | You have to be online to see this screen

  //- Funding
  div(ng-show="!loadingAccount && !account.Balance && loadState.account && connected")
    include ../tabs/banner/unfunded

  div(ng-show='hasRTJapanTrust')
    include banner/rtjapan
  div(ng-show='hasRTJapanTrustWithRippling')
    include banner/rtjapanrippling

  .row(ng-show='connected')
    .col-sm-3
      include ../tabs/fund/menu
    .col-sm-9.list
      .fundAcct(ng-show="currencyPage == 'accounts'", ng-controller='TrustCtrl')
        .row
          .col-sm-2
            a.btn.btn-success.btn-sm.btn-block(ng-click='toggle_form()', ng-disabled='addform_visible || editform_visible', l10n) Add trust
        .row
          .col-xs-12.col-sm-6
            form.row-padding-small#trustForm(name='trustForm', ng-submit='grant()')
              .row
                .col-xs-12.form-group
                  label(for='trust_counterparty', ng-show="edituser", ng-bind="edituser") 
                  input.form-control#trust_counterparty(
                    name='trust_counterparty', type='text', rp-combobox="counterparty_query"
                    rp-combobox-value-as-ripple-name
                    l10n-placeholder="Enter a Ripple name or contact"
                    ng-model='counterparty_view'
                    rp-dest, rp-dest-address, rp-dest-contact, rp-not-me, rp-dest-email
                    rp-dest-ripple-name, rp-dest-model="counterparty"
                    required
                    rp-autofill='$routeParams.to'
                    rp-autofill-counterparty_view
                    rp-autofill-on='addform_visible = true'
                    rp-focus, rp-spinner)
                  .errorGroup(ng-messages='trustForm.trust_counterparty.$dirty && trustForm.trust_counterparty.$error')
                    div(ng-show='trustForm.trust_counterparty.$valid')
                      .success(ng-show='counterparty != counterparty_address && counterparty_name && !error_account_reserve', ng-bind="counterparty_address")
                      .error(ng-show='error_account_reserve')
                        span(l10n) Account does not meet the minimum XRP reserve.&#32;
                        a(href="https://ripple.com/wiki/Account_Creation", target="_blank", l10n)
                          | More information
                    .error(ng-message='required', l10n) Please enter a Ripple name, contact, or address.
                    .error(ng-message='rpNotMe', l10n) You've entered your own address.
                    .error(ng-message='rpDest', l10n) Please enter a valid Ripple name, contact, or address.
              .row
                .col-xs-12.form-group
                  label(for='trust_amount', l10n) Amount
                  .row
                    .col-md-5
                      input.form-control.value#trust_amount(name='trust_amount'
                        type='number', step='any', ng-model='amount'
                        ng-pattern='validation_pattern'
                        rp-autofill='$routeParams.amount'
                        rp-autofill-amount
                        rp-autofill-on='addform_visible = true'
                        required)
                    .col-md-7
                      input.form-control.currency-field#trust_amount_currency(name='trust_amount_currency', type='text'
                        ng-model='currency', rp-combobox="currency_query", rp-combobox-select
                        rp-autofill='$routeParams.amount'
                        rp-autofill-currency
                        rp-autofill-on='addform_visible = true'
                        rp-not-xrp
                        required)
                  .errorGroup(ng-messages='trustForm.trust_amount.$dirty && trustForm.trust_amount.$error')
                    .error(ng-message='required', l10n) Amount field is required
                  .errorGroup(ng-messages='trustForm.trust_amount_currency.$dirty && trustForm.trust_amount_currency.$error')
                    .error(ng-message='rpNotXrp', l10n)
                      | XRP can be sent without extending trust. If you really want
                      |  to trust in XRP, please use XRR currency code.
                    .error(ng-message='required', l10n)
                      | Currency field is required
              .row
                .col-xs-12.allow-rippling
                  label.checkbox(for="trust_allowrippling")
                    input#trust_allowrippling(
                      name='trust_allowrippling', type='checkbox'
                      ng-model='allowrippling')
                    span(l10n) Allow Rippling
                  i.fa.fa-question-circle.help-icon(
                    rp-popover
                    rp-popover-placement="bottom"
                    l10n-rp-popover-title="Allow Rippling"
                    rp-popover-trigger="click"
                    l10n-data-content="Allow this trust line's balances to be transferred to another issuer you trust. <a href=https://ripple.com/wiki/No_Ripple target=_blank>More information</a>")
              .row
                .col-xs-6.col-sm-4
                  button.btn.btn-block.btn-default(type="button", ng-click='toggle_form()', l10n) Cancel
                .col-xs-6.col-sm-8
                  button.btn.btn-block.btn-primary.submit(type='submit', ng-disabled='trustForm.$invalid || verifying', l10n) Save
